import http from '@/http';
import type {LikeParams, LikeType, ResponseData} from '@/types/interface';

const likeApi = {
    // 点赞
    addLike: (data: LikeParams): Promise<ResponseData<boolean>> => {
        return http.post('/like/add', data);
    },

    // 取消点赞
    cancelLike: (data: LikeParams): Promise<ResponseData<boolean>> => {
        return http.post('/like/cancel', data);
    },

    // 检查是否已点赞
    checkLike: (targetId: number, likeType: LikeType): Promise<ResponseData<{ isLike: boolean }>> => {
        return http.get(`/like/check?targetId=${targetId}&likeType=${likeType}`);
    }
};

export default likeApi;